import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: '登录'
    },
    component: resolve => { require(['@/views/login.vue'], resolve); }
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: resolve => { require(['@/views/error-page/404.vue'], resolve); }
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: resolve => { require(['@//views/error-page/403.vue'], resolve); }
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: resolve => { require(['@/views/error-page/500.vue'], resolve); }
};

export const preview = {
    path: '/preview',
    name: 'preview',
    component: resolve => { require(['@/views/form/article-publish/preview.vue'], resolve); }
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: resolve => { require(['@/views/main-components/lockscreen/components/locking-page.vue'], resolve); }
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/home',
    name: 'otherRouter',
    component: Main,
    children: [
        {
            path: '/home/registration',
            title: '挂号',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/registration.vue'], resolve); }
        },
        {
            path: '/home/process',
            title: '挂号处理',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/process.vue'], resolve); }
        },
        {
            path: '/home/registeredprocess',
            title: '挂号处理',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/registeredProcess.vue'], resolve); }
        },
        {
            path: '/home/rehandle',
            title: '挂号处理',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/rehandle.vue'], resolve); }
        },
        {
            path: '/home/vaccinePlan',
            title: '挂号处理',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/vaccinePlan.vue'], resolve); }
        },
        {
            path: '/home/theAppoint',
            title: '本次预约',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/theAppoint.vue'], resolve); }
        },
        {
            path: '/home/lastAppoint',
            title: '上次预约',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/lastAppoint.vue'], resolve); }
        },
        {
            path: '/home/inoculateHistory',
            title: '接种历史',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/inoculateHistory.vue'], resolve); }
        },
        {
            path: '/home/adultRegister',
            title: '成人挂号',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/adultRegister.vue'], resolve); }
        },
        {
            path: '/home/allAppoint',
            title: '全部预约',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/allAppoint.vue'], resolve); }
        },
        {
            path: '/home/inoculateHistoryAdult',
            title: '成人接种',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/inoculateHistoryAdult.vue'], resolve); }
        },
        {
            path: '/home/certify',
            title: '认证',
            name: 'home_index',
            component: resolve => { require(['@/views/inoculate/certify.vue'], resolve); }
        }
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/home',
        icon: 'home',
        component: Main,
        title: '接种挂号',
        children: [{
            path: 'index',
            title: 'home',
            name: 'home_index',
            role: 'home',
            component: resolve => { require(['@/views/home/home.vue'], resolve); }
        }]
    }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    preview,
    locking,
    ...appRouter,
    page500,
    page403,
    page404
];
